package c.j.a.d.b.j;

import c.j.a.c.y.a.i;
import c.j.a.d.b.e.b;
import c.j.a.d.b.i.f;
import c.j.a.d.b.i.g;
import com.ss.android.socialbase.downloader.g.e;
import f.a0;
import f.d;
import f.v;
import f.x;
import java.io.IOException;
import java.util.List;

/* compiled from: DefaultDownloadHeadHttpService */
public class k implements g {

    /* compiled from: DefaultDownloadHeadHttpService */
    public class a implements f {
        public final /* synthetic */ a0 a;
        public final /* synthetic */ d b;

        public a(k kVar, a0 a0Var, d dVar) {
            this.a = a0Var;
            this.b = dVar;
        }

        public String a(String str) {
            str = this.a.f.c(str);
            return str != null ? str : null;
        }

        public int b() throws IOException {
            return this.a.c;
        }

        public void c() {
            d dVar = this.b;
            if (dVar != null && !((x) dVar).b.d) {
                ((x) this.b).a();
            }
        }
    }

    public f a(String str, List<e> list) throws IOException {
        v v = b.v();
        if (v != null) {
            f.y.a aVar = new f.y.a();
            aVar.e(str);
            aVar.d("HEAD", null);
            if (list != null && list.size() > 0) {
                for (e eVar : list) {
                    aVar.a(eVar.a, c.j.a.d.b.n.a.U(eVar.b));
                }
            }
            d a = v.a(aVar.b());
            a0 b = ((x) a).b();
            if (i.s(2097152)) {
                b.close();
            }
            return new a(this, b, a);
        }
        throw new IOException("can't get httpClient");
    }
}
